<template>
  <!-- <h1>{{ $t(langMap.app_title) }}</h1> -->
  <h1>这是demo页</h1>
  <ul>
    <li><router-link to="/hello">链接跳转helloworld页</router-link></li>
    <li><a @click="goTo('/hello')">点击事件跳转helloWorld页</a></li>
    <li><a @click="goTo('/mockDemo')">点击事件跳转mockDemo页</a></li>
    <li><a @click="goTo('/MockApiDemo')">点击事件跳转MockApiDemo页</a></li>
    <li><a @click="goTo('/sassDemo')">点击事件跳转sassDemo页</a></li>
    <!-- <li><a @click="goTo('/ipcDemo')">点击事件跳转ipcDemo页</a></li> -->
    <li>
      <el-select v-model="windowPath" value-key="" placeholder="输入路由地址" clearable filterable>
        <el-option v-for="path in routerPaths" :key="path" :label="path" :value="path"> </el-option>
      </el-select>
      <el-button @click="openWindow">新建窗口</el-button>
    </li>
  </ul>
  <h1>这是demo页 当前计数为：{{ counterStore.counter }}</h1>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { useCounterStore } from '@store/counterStore'
// import langMap from '@/locales/LangMap'

const router = useRouter()

// 点击事件跳转对应页面
function goTo(path: string) {
  router.push(path)
}

import { ref } from 'vue'
import electronUtils from '@/utils/electronUtils'

const counterStore = useCounterStore()

const windowPath = ref<string>('/hello')
const routerPaths = ref<string[]>([])
// 取到所有的路径
routerPaths.value = router.getRoutes().map((item) => item.path)
console.log(routerPaths.value)

function openWindow() {
  console.log(windowPath.value)
  electronUtils.openWindow(windowPath.value)
}
</script>

<style scoped>
ul {
  list-style: none;
}
</style>
